package com.liao.furns.dao.impl;

import com.liao.furns.dao.BasicDAO;
import com.liao.furns.dao.OrderDAO;
import com.liao.furns.pojo.Order;

import java.util.List;

/**
 * @author lzp
 * @version 1.0
 * lzpnb!
 */
public class OrderDAOImpl extends BasicDAO<Order> implements OrderDAO {

    @Override
    public int saveOrder(Order order) {
        String sql = "INSERT INTO `order`(`id`,`create_time`,`price`,`status`,`member_id`) \n" +
                "VALUES(?,?,?,?,?) ";
        return update(sql,order.getId(),order.getCreateTime(),order.getPrice(),order.getStatus(),order.getMemberId());
    }

    @Override
    public List<Order> queryOrderByMemberID(int id) {
        String sql = "SELECT `id`,`create_time` createTime,`price`,`status`,`member_id` memberId FROM `order`  \n" +
                "WHERE member_id = ?";
        return queryMulti(sql, Order.class,id);
    }

}
